Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix touch parse date error #2317

Merged
merged 1 commit into from
May 31, 2021
Merged

Conversation

deantvv
Copy link
Contributor

@deantvv deantvv commented May 31, 2021

Now it can parse touch -d 2000-01-23 file

Related to #2311

Copy link
Sponsor Contributor

@sylvestre sylvestre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, just some minor changes

Err(e) => panic!("Unable to parse date\n{}", e),
let formats = vec!["%c", "%F"];
for f in formats {
match time::strptime(str, f) {
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please fix the clippy warning

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

}
panic!("Unable to parse date\n");
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a test to trigger this error (and probably use show_error instead of a panic)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test added and use show_error.

Now it can parse `touch -d 2000-01-23 file` and add test for parse date
error.

Related to uutils#2311
@sylvestre
Copy link
Sponsor Contributor

Increased the number of gnu tests by 2, well done :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants